//当手机号码输入框获取焦点
$("#phone-ipt").eq(0).focus(function(){
	//边框变色
	$("#phone-ipt").css({"border":"1px solid","border-color":"#ff9900"});
	//正确图标消失
	$(".proper_icon").css("display","none");
	
})
var phone = true;
//手机号码输入框失去焦点时;
$("#phone-ipt").blur(function(){
	//如果手机号不正确或输入框为空,返回false
	if(!(/^1[34578]\d{9}$/.test($("#phone-ipt").val())) || $("#phone-ipt").val() == null){ 
		//错误图标出现
        $("#Error-1").css("display","block");
		//输入框颜色变为红色
		$("#phone-ipt").css({"border":"1px solid","border-color":"#e60000"});
		//输入框字体变为红色
		$("#phone-ipt").css("color","#e60000");
		phone = false;
	}else{
		//错误提示框隐藏
		$("#Error-1").css("display","none");
		//正确图标显示
		$(".proper_icon").css("display","block");
		//输入框颜色变为绿色
		$("#phone-ipt").css({"border":"1px solid","border-color":"#59A358"});
		//输入框字体变为黑色
		$("#phone-ipt").css("color","#000000");
	}
 });
 var password = true;
 // 输入密码获取焦点
 $("#password-ipt").eq(0).focus(function(){
	 //边框变色
	 $("#password-ipt").css({"border":"1px solid","border-color":"#ff9900"});
	 //正确图标消失
	 $(".proper_icon").css("display","none");
 })
//  //输入密码失去焦点;
 $("#password-ipt").blur(function(){
	 //如果是纯数字或纯字母或纯特殊符号
	 if(/^(?:\d+|[a-zA-Z]+|[!@#$%^&*]+){6,20}$/.test($("#password-ipt").val())){
		 //报错提示框隐藏
		 $("#Error-2").css("display","none");
		 //正确图标显示
		 $(".proper_icon_pass").css("display","block");
		 //输入框颜色变成绿色
		 $("#password-ipt").css({"border":"1px solid","border-color":"#59A358"});
		 //密码强度提示显示
		 $(".pass_span").css("display","block");
		 //修改提示框文字
		 $(".pass_span").html("密码强度：弱");
		 //输入框字体变为黑色
		 $("#password-ipt").css("color","#000000");
	 }else if(/^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*]+$)[a-zA-Z\d!@#$%^&*]+$/.test($("#password-ipt").val())){
		 //报错提示框隐藏
		 $("#Error-2").css("display","none");
		 //正确图标显示
		 $(".proper_icon_pass").css("display","block");
		 //输入框颜色变成绿色
		 $("#password-ipt").css({"border":"1px solid","border-color":"#59A358"});
		 //密码强度提示显示
		 $(".pass_span").css("display","block");
		 //修改提示框文字
		 $(".pass_span").html("密码强度：中");
		 //输入框字体变为黑色
		 $("#password-ipt").css("color","#000000");
	 }else if(/^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*]+$)(?![a-zA-z\d]+$)(?![a-zA-z!@#$%^&*]+$)(?![\d!@#$%^&*]+$)[a-zA-Z\d!@#$%^&*]+$/.test($("#password-ipt").val())){
		 $("#Error-2").css("display","none");
		 $(".proper_icon_pass").css("display","block");
		 $("#password-ipt").css({"border":"1px solid","border-color":"#59A358"});
		 $(".pass_span").css("display","block");
		 $(".pass_span").html("密码强度：强");
		 //输入框字体变为黑色
		 $("#password-ipt").css("color","#000000");
	 }else{
		 $("#Error-2").css("display","block");
		 $(".proper_icon_pass").css("display","none");
		 //输入框颜色变为红色
		 $("#password-ipt").css({"border":"1px solid","border-color":"#e60000"});
		 //输入框字体变为红色
		 $("#password-ipt").css("color","#e60000");
		 //密码强度显示隐藏
		 $(".pass_span").css("display","none");
		 password = false;
	 }
 })
 var passAgain = true;
 //确认密码获得焦点
 $("#passArgin-ipt").eq(0).focus(function(){
	 //边框变色
	 $("#passArgin-ipt").css({"border":"1px solid","border-color":"#ff9900"});
	 //正确图标消失
	 $("proper_passArgin").css("display","none");
 })
 //确认密码失去焦点
 $("#passArgin-ipt").blur(function(){
	 if( $("#password-ipt").val() != $("#passArgin-ipt").val()){
		 //错误提示框显示
		 $("#Error-3").css("display","block");
		 //正确提示框隐藏
		 $(".proper_passArgin").css("display","none");
		 //输入框颜色变为红色
		 $("#passArgin-ipt").css({"border":"1px solid","border-color":"#e60000"});
		 //输入框字体变为红色
		 $("#passArgin-ipt").css("color","#e60000");
		 passAgain = false;
	 }else{
		 //报错提示框隐藏
		 $("#Error-3").css("display","none");
		 //正确图标显示
		 $(".proper_passArgin").css("display","block");
		 //输入框颜色变成绿色
		 $("#passArgin-ipt").css({"border":"1px solid","border-color":"#59A358"});
		 //输入框字体变为黑色
		 $("#passArgin-ipt").css("color","#000000");
	 }
 })
 //提交按钮点击事件
 $("#ipt_button").on("click",function(){
	 if(phone == false || password == false || passAgain == false){
		 $("#Error-1").css("display","block");
		 $("#Error-2").css("display","block");
		 $("#Error-3").css("display","block");
	 }else if($("#phone-ipt").val().length ==0 || $("#password-ipt").length ==0 || $("#passArgin-ipt").length ==0 ){
		 $("#Error-1").css("display","block");
		 $("#Error-2").css("display","block");
		 $("#Error-3").css("display","block");
	 }else{
		 $(location).attr('href', 'Sign.html');
	 }
 })